<?php

namespace App\Http\Middleware;

use Closure;
use Session;

class CheckLogin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
		// 没有 后台管理员 登录信息
		if( empty( Session::get('admin_id') ) ) 
		{
			// 跳转到 登录页面
			return redirect('/admin/login');
		}
		
        return $next($request);
    }
}
